package test;

import java.util.Random;

public class main {
    public static void main(String[] args) {
        int [] temp = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
        Random random = new Random();
        for (int i = 0; i < temp.length; i++) {
        int index = random.nextInt(temp.length);
        int temp1 = temp[i];
        temp[i] = temp[index];
        temp[index] = temp1;
        }
        for (int i = 0; i < temp.length; i++) {
            System.out.print(temp[i]+" ");
        }
        System.out.println();
        int[][] data = new int[4][4];
        int index=0;
        for (int i = 0; i < data.length; i++) {
            for (int j = 0; j < data[i].length; j++) {
                data[i][j]=temp[index];
                index++;
            }
        }
        for (int i = 0; i < data.length; i++) {
            for (int j = 0; j < data[i].length; j++) {
                System.out.print(data[i][j]+" ");
            }
            System.out.println();
        }
    }
}
